# -*- coding: utf-8 -*-
#coding=utf-8

import config
from errors import InvalidArgumentsError

'''
Modules management
'''
class modules(object):
    def __init__(self, group):
        if not config.MODULES.has_key(group):
            raise InvalidArgumentsError('Group')

        self.modules = []

        for v in config.MODULES[group]:
            if not v['disabled']:
                self.modules.append([v['id'],v['name.default'], v['module'], v['icon']])
        self.modules.sort(lambda a,b :cmp(a[0], b[0]))

    def get(self):
        return self.modules
        
